package com.starbaba.system.managelog.model;

public class OperState {
	public static final Long SUCCESS = new Long(0);
	public static final Long ERROR = new Long(100);
	public static final Long ABORT = new Long(200);

	public static final String[] CODES = { "", "0", "100", "200" };
	public static final String[] NAMES = { "", "完成", "出错", "终止" };

	public static String getName(String code) {
		if (code == null) {
			return null;
		}

		for (int i = 0; i < CODES.length; i++) {
			if (code.equals(CODES[i])) {
				return NAMES[i];
			}
		}

		return "";
	}

	public static String getCode(String name) {
		if (name == null) {
			return null;
		}

		for (int i = 0; i < NAMES.length; i++) {
			if (name.equals(CODES[i])) {
				return CODES[i];
			}
		}

		return "";
	}
}
